<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-control" content="max-age=1700" />

<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
<meta name="MobileOptimized" content="320" />
<meta name="format-detection" content="telephone=no" />

<link href="${ctx}/css/wxflow.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/fonts/font.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="${ctx}/js/jquery.min.js"></script> 
<script src="${ctx}/js/handlebars-v2.0.0.js"></script>
<script type="text/javascript" src="${ctx}/js/common.js"></script>

<title>流量e超市-购买记录</title>
<script id="orderList" type="text/x-handlebars-template">
   {{#each this}} 
        <li>
            <div class="phone-list-l">
                	<p>{{mobile}}</p>
	      			<p>{{productName}}</p>
                    <p>{{orderDate}}</p>
            </div>
            <div class="phone-list-r">
                	<p>{{dPrice}}元</p>
                    <p>{{orderStateStr orderState}}</p>
            </div>
            <div class="clear-both"></div>
        </li>
   {{/each}}
</script>
<script>

var page = 1,rows=20,totalPage;
Handlebars.registerHelper('orderStateStr',function(orderState,options){
    if(orderState==9){
        return '充值成功';
    }
    if(orderState==1){
        return '准备充值';
    }
    if(orderState==2){
        return '充值失败，请联系客服人员';
    }
    if(orderState==-1){
        return '充值失败，待退款';
    }
    if(orderState==-9){
        return '充值失败，已退款';
    }
});
$(function() {  
    show(1);
});
var orderList=Handlebars.compile($('#orderList').html());
function show(pageNo){
    page=pageNo; 
    $.ajax({ 
        url: '${ctx}/getOrderList',
        type: 'POST',
        data: {page:page,rows:rows},
        cache:false,
        dataType:'json',  
        success: function(data){  
        	var html =orderList(data); 
            $('.phone-list').html(html);
          },
        error : function(data) {    
            alert(data);
        }    
    });
}

</script>
</head>
<body>
<div class="order_wrap">
	<ul class="phone-list">
    	
    </ul>
    <p class="ex-tittle">
    	温馨提示
    </p>
    <ul class="ex-word">
    	<li>
        	在您充值成功后，我们会立即提交充值。
        </li>
    </ul>
</div>

</body>
</html>




